﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="adadd.aspx.cs" Inherits="UI.system.page.ad.adadd" %>
<%@ Import Namespace="Model" %>
<%@ Import Namespace="Common" %>
<div style="margin: 15px;">
	<form class="layui-form" style="padding-left:0px;">
        <div class="layui-form-item">
			<label class="layui-form-label"><font>名称</font><em>*</em></label>
			<div class="layui-input-block">
                <input type="text" name="name" placeholder="请输入名称" lay-verify="required" autocomplete="off" class="layui-input" value="<%=info.Name %>">
			</div>
		</div>
        <div class="layui-form-item">
			<label class="layui-form-label">图片</label>
			<div class="layui-input-inline">
				<div class='upload_product upload_file_o <%=string.IsNullOrEmpty(info.Img)?"":"hidden" %>'><div id="upload_file_o"></div></div>
                 <div class='upload_show <%=string.IsNullOrEmpty(info.Img)?"hidden":"" %>'>
                     <div class="img_container" src="<%=info.Img %>"><img src="<%=info.Img %>"/></div>
                     <div class="reupload"><a onclick="Re_Upload(this)">重传</a></div>
                 </div> <div style="float:left; color:red; padding-top:5px; font-size:12px; padding-left:10px;"></div>
			</div>
		</div>
        <div class="layui-form-item">
			<label class="layui-form-label"><font>位置</font><em>*</em></label>
			<div class="layui-input-block">
				<select id="position" name="position" lay-verify="required" lay-filter="sendtype">
                        <%foreach (int key in Commons.Position.Keys)
                          {
                              if (key > 0)
                              {
                              %>
                        
					    <option value="<%=key %>" <%=info.Position==key?"selected":"" %>><%=Commons.Position[key]%></option>
					    <%}} %>
				</select>
			</div>
		</div>
        <div class="layui-form-item">
			<label class="layui-form-label"><font>显示顺序</font><em>*</em></label>
			<div class="layui-input-inline">
                <input type="text" name="sort" placeholder="请输入显示顺序" lay-verify="required" class="layui-input" value="<%=info.Sort %>">
			</div>
		</div>
        <div class="layui-form-item">
			<label class="layui-form-label"><font>广告内容</font><em>*</em></label>
			<div class="layui-input-block">
                <input type="radio" name="froms" lay-filter="froms" value="1" title="自定义内容" <%=info.Froms==1?"checked='checked'":"" %>>
                <input type="radio" name="froms" lay-filter="froms" value="2" title="跳转到商城公告" <%=info.Froms==2?"checked='checked'":"" %>>
                <input type="radio" name="froms" lay-filter="froms" value="3" title="跳转到产品详情" <%=info.Froms==3?"checked='checked'":"" %>>
			</div>
		</div>
        <div class='context layui-form-item <%=info.Froms==1?"":"hidden" %>'>
			<label class="layui-form-label"></label>
			<div class="layui-input-block">
                <script id="context" type="text/plain" style="width:100%;height:250px;"><%=info.Context %></script>
			</div>
		</div>
        <div class='news layui-form-item <%=info.Froms==2?"":"hidden" %>'>
			<label class="layui-form-label"></label>
			<div class="layui-input-block">
                <font id="newsid" val="<%=info.SID %>"><%=title%></font><br />
                <a onclick="Select_News()">选择公告</a>
			</div>
		</div>
        <div class='product layui-form-item <%=info.Froms==3?"":"hidden" %>'>
			<label class="layui-form-label"></label>
			<div class="layui-input-block">
                <font id="productid" val="<%=info.SID %>"><%=title%></font><br />
                <a onclick="Select_Product()">选择产品</a>
			</div>
		</div>
		<a lay-filter="save" lay-submit style="display: none;"></a>
	</form>
</div>
<script>
    layui.use(["form", "table", "laydate"], function () {
        var $ = layui.jquery, form = layui.form, laydate = layui.laydate;
        table = layui.table;
        laydate.render({
            elem: '#begindate',
            type: 'datetime',
            format: 'yyyy-MM-dd HH:mm'
        });
        laydate.render({
            elem: '#enddate',
            type: 'datetime',
            format: 'yyyy-MM-dd HH:mm'
        });
        form.on("radio(froms)", function (data) {
            if (data.value == "1") {
                $(".context").show();
                $(".news").hide();
                $(".product").hide();
            } else if (data.value == "2") {
                $(".news").show();
                $(".context").hide();
                $(".product").hide();
            } else if (data.value == "3") {
                $(".product").show();
                $(".context").hide();
                $(".news").hide();
            }
        });
    });

    function Select_News() {
        Ajax.Get("/system/page/ad/selectnews.aspx", function (html) {
            product_index = window.parent.LayerBox.Search("选择资讯", html, 830, 600);
        });
    };
    function Select_Product() {
        Ajax.Get("/system/page/ad/selectproduct.aspx", function (html) {
            product_index = window.parent.LayerBox.Search("选择商品", html, 830, 600);
        });
    };
</script>